Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Adding support for EVM view and function calls #517

Merged
merged 13 commits into from
Nov 17, 2020
Merged

Conversation

ilblackdragon
Copy link
Member

@ilblackdragon ilblackdragon commented Aug 30, 2020

Example usage

For any EVM call you need to specify:

  • EVM account name (e.g. evm.illia)
  • contract id
  • method name
  • list of arguments
  • ABI path to encode parameters

View call:

./bin/near evm-view evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d getBLabs '[]' --abi=../evm/balancer-core/build/contracts/BFactory.json  --accountId illia

Schedule a transaction:

./bin/near evm-call evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d newBPool '[]' --abi=../evm/balancer-core/build/contracts/BFactory.json  --accountId illia

commands/evm-call.js Show resolved Hide resolved
commands/evm-call.js Outdated Show resolved Hide resolved
default: '100000000000000'
})
.option('amount', {
desc: 'Number of tokens to attach',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In NEAR or yoctoNEAR

@mikedotexe
Copy link
Contributor

mikedotexe commented Aug 31, 2020

I noticed that this fails:
./bin/near evm-view evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d getBLabs '[]' --abi=/Users/mike/near/balancer-core/build/contracts/BFactory.json --accountId illia
Unless I've symlinked it to my near-web3-provider and am on the fixing-testing branch.
I think we can merge the PR for that, also we could publish that as an NPM package. This is super good progress.
I'll address the issues Evgeny brought up in the comments.

@mikedotexe
Copy link
Contributor

@ilblackdragon I'm getting GasLimitExceeded when I try to run:
./bin/near evm-call evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d newBPool '[]' --abi=/Users/mike/near/balancer-core/build/contracts/BFactory.json --accountId mike.testnet

Have also tried:
./bin/near evm-call evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d newBPool '[]' --abi=/Users/mike/near/balancer-core/build/contracts/BFactory.json --accountId mike.testnet --gas 300000000000000

and

NEAR_ENV=testnet ./bin/near evm-call evm.illia 0x55a641c83b27fc2dd2bf757c56206114c5b8a46d newBPool '[]' --abi=/Users/mike/near/balancer-core/build/contracts/BFactory.json --accountId mike.testnet --gas 300000000000000 --nodeUrl=http://34.94.236.61:3030

as well as changing the nodeUrl key in near-cli's config to have the canary nodeUrl

@mikedotexe
Copy link
Contributor

Looks like amount and gas flags aren't being used, I can try to work those into the .send in evm-call.js

# Conflicts:
#	bin/near-cli.js
#	package.json
#	yarn.lock
@mikedotexe
Copy link
Contributor

Shoot, I'm trying this again on Pet Shop. The evm-view call works great. I keep getting an issue on the evm-call

For instance:
NEAR_ENV=local ./bin/near evm-call evm 0xE5D4Dbb86d8bb8a001A613537C2e879902F8c2F4 adopt '{"pedId": "6"}' --abi ~/near/random/pet-shop/build/contracts/Adoption.json --accountId test.near

will error with:

Error: Provided address "1.3121057848489336e+48" is invalid, zzthe capitalization checksum test failed, or its an indrect IBAN address which can't be converted.
at Object.inputAddressFormatter (/Users/mike/near/near-shell/node_modules/web3-core-helpers/lib/formatters.js:400:11)
at Object.set [as address] (/Users/mike/near/near-shell/node_modules/web3-eth-contract/lib/index.js:77:69)
at Contract (/Users/mike/near/near-shell/node_modules/web3-eth-contract/lib/index.js:251:26)
at new Contract (/Users/mike/near/near-shell/node_modules/web3-eth/lib/index.js:257:22)
at scheduleEVMFunctionCall (/Users/mike/near/near-shell/commands/evm-call.js:52:22)
at Object.handler (/Users/mike/near/near-shell/utils/exit-on-error.js:37:31)
at /Users/mike/near/near-shell/node_modules/yargs/build/index.cjs:435:71

Looking into this now.

@mikedotexe
Copy link
Contributor

Note: we are going to hold off on merging this until we've resolved this issue:
near/nearcore#3544

@mikedotexe mikedotexe marked this pull request as draft October 30, 2020 18:48
@mikedotexe mikedotexe marked this pull request as ready for review November 16, 2020 17:11
@mikedotexe mikedotexe merged commit d55a359 into master Nov 17, 2020
@mikedotexe mikedotexe deleted the eth-support branch November 17, 2020 00:52
crypto-guys pushed a commit to crypto-guys/near-cli that referenced this pull request Feb 18, 2021
* Adding support for EVM view and function calls.

* Move things around a bit in eth-call

* Fix linter

* evm-call renaming: evmAccounts » nearEvmAccountId, contractName » evmContractName

* specify gas as "NEAR gas" in evm-call

* correct search/replace mistake key evmAccountId for NearProvider added back

* standardize arg names, log args better, unique names for scheduleEVMFunctionCall

* package.json: latest version for near-api-js and near-web3-provider

* update yarn.lock file

* readme: add evm-view/evm-call

Co-authored-by: Mike Purvis <mikedotexe@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants